@layout("/common/default.html",{title:'添加',libs:['form']}){


  <form class="layui-form"  lay-filter="layui-form-dictType" id="layui-form-dictType">
    <!--form表单-->
    <input type="hidden" id="onlyid" name="id" value="${dictType.id!}">
    <input type="hidden" id="op" name="op" value="${dictType.op!}">


    <div class="layui-fluid">
      <div class="layui-card">
        <div class="layui-card-header">添加类型</div>
        <div class="layui-card-body">
          <div class="layui-form-item layui-row">

            <div class="layui-inline layui-col-md9">
              <label class="layui-form-label layui-required">字典名称</label>
              <div class="layui-input-block">
                <input type="text" id="name" name="name" value="${dictType.name!}" placeholder="请输入" autocomplete="off" class="layui-input" lay-verify="required" required="">
              </div>
            </div>


            <div class="layui-inline layui-col-md9">
              <label class="layui-form-label layui-required ">字典类型</label>
              <div class="layui-input-block">
                <input type="text" id="type" name="type" value="${dictType.type!}" placeholder="请输入" autocomplete="off" class="layui-input" lay-verify="required" required="">
              </div>
            </div>



            <div class="layui-inline layui-col-md9">
              <label class="layui-form-label">备注</label>
              <div class="layui-input-block">
                <input type="text" id="remarks" name="remarks" value="${dictType.remarks!}" placeholder="请输入" autocomplete="off" class="layui-input" >
              </div>
            </div>

            <div class="layui-inline layui-col-md9">
              <label class="layui-form-label layui-required">排序</label>
              <div class="layui-input-block">
                <input type="text" id="sort" name="sort" value="${dictType.sort!}" placeholder="请输入" autocomplete="off" class="layui-input" lay-verify="required" required="">
              </div>
            </div>
          </div>

        </div>

      </div>
    </div>

    <div class="form-group-bottom" style="z-index: 200" align="center">
      <button class="layui-btn" lay-filter="btnSubmit" lay-submit>&emsp;提交&emsp;</button>
      <button   id="btnclose" class="layui-btn layui-btn-primary"  >&emsp;取消&emsp;</button>
    </div>
  </form>

<!--js逻辑-->
<script>

  layui.use(['form', 'submitform','openLayer','utils'], function () {

         var $ = layui.$,
            form = layui.form,
                 openLayer=layui.openLayer,
                 utils=layui.utils,
             submitform = layui.submitform;
         //字典类型
        $("#type").change(function(obj){
          var json={
            type:$("#type").val(),
          };
          utils.checkchange('/sys/dictType/checkType',json,"type");

          //submitform.form('/sys/dictType/save',field,demomode);
          /*var obj=resAjax.render({
            url:"/sys/dictType/checkType", //url
            type:"post",//类型
            data:json,//id
          });
          if(obj.code="10000"){
            layer.msg(obj.msg);
            $("#password").val("");
          }
          */
        });

          form.on("submit(btnSubmit)", function (data) {
            var field = data.field;
            // 请求后台
            submitform.form('/sys/dictType/save',field);

            return false;
          });

        });
</script>

@}
